package com.neusoft.mapper;

import java.math.BigDecimal;
import java.util.List;

import com.neusoft.po.WalletTrans;
import org.apache.ibatis.annotations.*;

import com.neusoft.po.Wallet;

@Mapper
public interface WalletMapper {

    @Insert("insert into wallet values(0, #{userId})")
    public int saveWallet(String userId);

    @Update("update wallet set money = #{money} where userId = #{userId}")
    public int updateMoney(@Param("userId") String userId, @Param("money") BigDecimal money);

    @Select("select * from wallet where userId = #{userId}")
    public Wallet getWalletByUserid(String userId);

    @Insert("insert into wallettrans values(null,#{userId},#{time},#{money},#{type},#{inId},#{outId})")
    public int saveTransaction(String userId,String time,BigDecimal money,int type,String inId,String outId);

    @Select("select * from wallettrans where userId = #{userId}")
    public List<WalletTrans> listWalletTransByUserId(String userId);
}
